home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / BroShip2.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  36.4 KB  |  1,277 lines

  1. class classes.bro.BroShip2
  2. {
  3.    var tX;
  4.    var x;
  5.    var tY;
  6.    var y;
  7.    var clip;
  8.    var w;
  9.    var h;
  10.    var weapon;
  11.    var trans;
  12.    var colorTrans;
  13.    var colorVars;
  14.    var life;
  15.    var fireDir;
  16.    var shotX;
  17.    var shotY;
  18.    var dirXArray;
  19.    var dirYArray;
  20.    var dirX;
  21.    var dirY;
  22.    var destX;
  23.    var destY;
  24.    var xyMetFunction;
  25.    var handState;
  26.    var baseSpeed = 6;
  27.    var speed = 6;
  28.    var fire = false;
  29.    var d = 999990;
  30.    var c = 0;
  31.    var fc = 0;
  32.    var shotID = 10000;
  33.    var xA = 0;
  34.    var yA = 0;
  35.    var f2 = "";
  36.    var facing = "R";
  37.    var hc = 0;
  38.    var fireFreq = 11;
  39.    var fireFreqOrig = 11;
  40.    var shieldOn = false;
  41.    var inv = false;
  42.    var control = true;
  43.    var exit = false;
  44.    var tagTeaming = false;
  45.    var bg = false;
  46.    var gesture = false;
  47.    var sl = "top";
  48.    var ofc = 0;
  49.    var endFire = false;
  50.    var hover = true;
  51.    function BroShip2(px, py)
  52.    {
  53.       this.tX = this.x = px;
  54.       this.tY = this.y = py;
  55.       this.clip = _root.attachMovie("broShip2","broShip2Clip",this.d);
  56.       this.w = this.clip._width;
  57.       this.h = this.clip._height;
  58.       this.clip._x = this.x;
  59.       this.clip._y = this.y;
  60.       this.weapon = _root.bro2Weapon;
  61.       this[this.weapon]();
  62.       this.trans = new flash.geom.Transform(this.clip);
  63.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
  64.       this.colorVars = new Object();
  65.       this.life = _root.bro2Life;
  66.       if(_root.bro2ShipVar == 1)
  67.       {
  68.          this.clip.body.shipStyles.gotoAndStop(_root.bro2ShipLevel);
  69.          if(_root.level == 1 && _root.shipPass && (_root.bro2ShipLevel == 2 || _root.bro2ShipLevel == 3) || _root.level == 2 && _root.bro2ShipLevel == 3)
  70.          {
  71.             _root.audio.playLevel2("tagTeam1",20);
  72.             this.colorFlash(255,255,255,30);
  73.             _root.shipPass = false;
  74.          }
  75.       }
  76.       else
  77.       {
  78.          this.clip.body.shipStyles.gotoAndStop(_root.bro2ShipVar);
  79.       }
  80.       var _loc3_ = _root.bro2ShipLevel <= 3 ? 1 + (_root.bro2ShipLevel - 1) * 2 : 1 + (_root.bro2ShipLevel - 4) * 2;
  81.       this.baseSpeed = this.speed = 5 + _loc3_;
  82.    }
  83.    function colorFlash(r, g, b, cMax)
  84.    {
  85.       this.colorVars.c = 0;
  86.       this.colorVars.r = r;
  87.       this.colorVars.g = g;
  88.       this.colorVars.b = b;
  89.       this.colorVars.cMax = cMax;
  90.       this.colorVars.flashing = true;
  91.    }
  92.    function nudge(pxA, pyA, pscale)
  93.    {
  94.       if((this.c == 0 || this.c > 5) && !this.inv)
  95.       {
  96.          this.c = 0;
  97.          var _loc2_ = pscale / 150;
  98.          this.xA = pxA * _loc2_;
  99.          this.yA = pyA * _loc2_;
  100.          this.f2 = "nudging";
  101.       }
  102.    }
  103.    function nudging()
  104.    {
  105.       this.xA *= 0.75;
  106.       this.yA *= 0.75;
  107.       this.c = this.c + 1;
  108.       if(this.c == 20)
  109.       {
  110.          this.xA = this.yA = 0;
  111.          this.f2 = "";
  112.          this.c = 0;
  113.       }
  114.    }
  115.    function powerUp(type)
  116.    {
  117.       if(type.substr(0,10) == "speedBoost")
  118.       {
  119.          var _loc3_ = Number(type.substr(10));
  120.          this.speedBoost(_loc3_ * 300);
  121.       }
  122.       else if(type.substr(0,11) == "weaponBoost")
  123.       {
  124.          _loc3_ = Number(type.substr(11));
  125.          this.weaponBoost(_loc3_ * 200);
  126.       }
  127.       else
  128.       {
  129.          this[type]();
  130.       }
  131.    }
  132.    function coin1()
  133.    {
  134.       _root.coins.addTo(1);
  135.       this.colorFlash(200,200,200,10);
  136.    }
  137.    function coin5()
  138.    {
  139.       _root.coins.addTo(5);
  140.       this.colorFlash(200,200,200,10);
  141.    }
  142.    function coin10()
  143.    {
  144.       _root.coins.addTo(10);
  145.       this.colorFlash(200,200,0,10);
  146.    }
  147.    function coin25()
  148.    {
  149.       _root.coins.addTo(25);
  150.       this.colorFlash(200,200,0,10);
  151.    }
  152.    function stealCoins(num)
  153.    {
  154.       if(!this.shieldOn && !this.inv)
  155.       {
  156.          _root.audio.playLevel2("coinDrain2",25);
  157.          var _loc4_ = random(num) + 2;
  158.          if(_root.coins.num - _loc4_ < 0)
  159.          {
  160.             _loc4_ = _root.coins.num;
  161.          }
  162.          _root.coins.addTo(-1 * _loc4_);
  163.          var _loc3_ = 0;
  164.          while(_loc3_ < _loc4_)
  165.          {
  166.             _root.fxID = _root.fxID + 1;
  167.             _root["coinDrain" + _root.fxID] = new classes.fx.CoinDrain(this.x + 6,this.y + 6,_root.fxID);
  168.             _root.addFX("coinDrain" + _root.fxID);
  169.             _loc3_ = _loc3_ + 1;
  170.          }
  171.       }
  172.    }
  173.    function gem1()
  174.    {
  175.       _root.gems.addTo(1);
  176.       this.colorFlash(40,255,180,15);
  177.    }
  178.    function gem2()
  179.    {
  180.       _root.gems.addTo(1);
  181.       this.colorFlash(0,90,200,15);
  182.    }
  183.    function gem3()
  184.    {
  185.       _root.gems.addTo(1);
  186.       this.colorFlash(255,50,0,15);
  187.    }
  188.    function gem4()
  189.    {
  190.       _root.gems.addTo(1);
  191.       this.colorFlash(255,170,30,15);
  192.    }
  193.    function gem5()
  194.    {
  195.       _root.gems.addTo(1);
  196.       this.colorFlash(255,100,255,15);
  197.    }
  198.    function gem6()
  199.    {
  200.       _root.gems.addTo(1);
  201.       this.colorFlash(0,255,180,15);
  202.    }
  203.    function smartBomb()
  204.    {
  205.       _root.smartBomb.gotoAndPlay(2);
  206.       var _loc2_ = 1;
  207.       var _loc3_ = _root.chars.length;
  208.       var _loc4_ = _root.chars.slice();
  209.       while(_loc2_ < _loc3_)
  210.       {
  211.          _root[_loc4_[_loc2_]].bombed(20);
  212.          _loc2_ = _loc2_ + 1;
  213.       }
  214.       _loc2_ = 0;
  215.       _loc3_ = _root.enemyShots.length;
  216.       _loc4_ = _root.enemyShots.slice();
  217.       while(_loc2_ < _loc3_)
  218.       {
  219.          _root[_loc4_[_loc2_]].bombed();
  220.          _loc2_ = _loc2_ + 1;
  221.       }
  222.       _loc2_ = 0;
  223.       _loc3_ = _root.FX.length;
  224.       _loc4_ = _root.FX.slice();
  225.       while(_loc2_ < _loc3_)
  226.       {
  227.          _root[_loc4_[_loc2_]].bombed();
  228.          _loc2_ = _loc2_ + 1;
  229.       }
  230.    }
  231.    function superP()
  232.    {
  233.       this.weaponBoost(600);
  234.       this.speedBoost(600);
  235.       this.shield();
  236.    }
  237.    function shield()
  238.    {
  239.       if(!this.shieldOn)
  240.       {
  241.          _root.shield = new classes.misc.Shield();
  242.          _root.addPowerUp("shield");
  243.          this.shieldOn = true;
  244.       }
  245.       else if(_root.shield.out)
  246.       {
  247.          _root.shield.renew();
  248.       }
  249.       this.colorFlash(70,180,250,30);
  250.    }
  251.    function rampage()
  252.    {
  253.       var _loc2_ = 0;
  254.       var _loc3_ = _root.powerUps.length;
  255.       while(_loc2_ < _loc3_)
  256.       {
  257.          if(_root.powerUps[_loc2_] == "rampage")
  258.          {
  259.             _root.removePowerUp("rampage");
  260.             break;
  261.          }
  262.          _loc2_ = _loc2_ + 1;
  263.       }
  264.       _root.rampage = new classes.misc.Rampage(300);
  265.       _root.addPowerUp("rampage");
  266.    }
  267.    function weaponBoost(num)
  268.    {
  269.       if(this.weapon == "laserA" || this.weapon == "doubleLaserA" || this.weapon == "tripleLaserA" || this.weapon == "bigLaser" || this.weapon == "twistLaser" || this.weapon == "tripleTwistLaser")
  270.       {
  271.          if(_root.currentBoost == "rapidFire")
  272.          {
  273.             _root.removePowerUp("rapidFire");
  274.          }
  275.          _root.currentBoost = "rapidFire";
  276.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  277.          if(this.weapon != "bigLaser")
  278.          {
  279.             _root.rapidFire = new classes.misc.RapidFire(num,false);
  280.          }
  281.          else
  282.          {
  283.             _root.rapidFire = new classes.misc.RapidFire(num,true);
  284.          }
  285.          _root.addPowerUp("rapidFire");
  286.       }
  287.       if(this.weapon == "rapidLaser" || this.weapon == "doubleRapidLaser")
  288.       {
  289.          if(_root.currentBoost == "laserBoost")
  290.          {
  291.             _root.removePowerUp("laserBoost");
  292.          }
  293.          _root.currentBoost = "laserBoost";
  294.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  295.          _root.laserBoost = new classes.misc.LaserBoost(num);
  296.          _root.addPowerUp("laserBoost");
  297.       }
  298.       if(this.weapon == "superLaser")
  299.       {
  300.          if(_root.currentBoost == "superRapidFire")
  301.          {
  302.             _root.removePowerUp("superRapidFire");
  303.          }
  304.          _root.currentBoost = "superRapidFire";
  305.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  306.          _root.superRapidFire = new classes.misc.SuperRapidFire(num);
  307.          _root.addPowerUp("superRapidFire");
  308.       }
  309.       this.colorFlash(255,125,0,30);
  310.    }
  311.    function checkBoost()
  312.    {
  313.       if(_root.currentBoost != "")
  314.       {
  315.          _root.removePowerUp(_root.currentBoost);
  316.          _root.currentBoost = "";
  317.          _root.laserPower = 8;
  318.       }
  319.    }
  320.    function doubleLaserA()
  321.    {
  322.       this.checkBoost();
  323.       _root.rapidVar = 4;
  324.       this.fireFreq = 11;
  325.       this.fireFreqOrig = 11;
  326.       _root.bro2Weapon = this.weapon = "doubleLaserA";
  327.       this.colorFlash(200,200,0,30);
  328.    }
  329.    function tripleLaserA()
  330.    {
  331.       this.checkBoost();
  332.       _root.rapidVar = 4;
  333.       this.fireFreq = 11;
  334.       this.fireFreqOrig = 11;
  335.       _root.bro2Weapon = this.weapon = "tripleLaserA";
  336.       this.colorFlash(255,160,0,30);
  337.    }
  338.    function rapidLaser()
  339.    {
  340.       this.checkBoost();
  341.       _root.rapidVar = 2;
  342.       this.fireFreq = 4;
  343.       this.fireFreqOrig = 4;
  344.       _root.bro2Weapon = this.weapon = "rapidLaser";
  345.       this.colorFlash(0,230,190,30);
  346.    }
  347.    function twistLaser()
  348.    {
  349.       this.checkBoost();
  350.       _root.rapidVar = 4;
  351.       this.fireFreq = 10;
  352.       this.fireFreqOrig = 10;
  353.       _root.bro2Weapon = this.weapon = "twistLaser";
  354.       this.colorFlash(100,200,230,30);
  355.    }
  356.    function tripleTwistLaser()
  357.    {
  358.       this.checkBoost();
  359.       _root.rapidVar = 4;
  360.       this.fireFreq = 10;
  361.       this.fireFreqOrig = 10;
  362.       _root.bro2Weapon = this.weapon = "tripleTwistLaser";
  363.       this.colorFlash(100,200,230,30);
  364.    }
  365.    function bigLaser()
  366.    {
  367.       this.checkBoost();
  368.       _root.rapidVar = 4;
  369.       this.fireFreq = 9;
  370.       this.fireFreqOrig = 9;
  371.       _root.bro2Weapon = this.weapon = "bigLaser";
  372.       this.colorFlash(0,130,255,30);
  373.    }
  374.    function superLaser()
  375.    {
  376.       this.checkBoost();
  377.       _root.rapidVar = 3;
  378.       this.fireFreq = 5;
  379.       this.fireFreqOrig = 5;
  380.       _root.bro2Weapon = this.weapon = "superLaser";
  381.       this.colorFlash(255,255,255,30);
  382.    }
  383.    function lifeUp()
  384.    {
  385.       if(this.life + 25 > 100)
  386.       {
  387.          _root.lifeMeter.adjust(this.life,100 - this.life);
  388.          this.life = 100;
  389.       }
  390.       else
  391.       {
  392.          _root.lifeMeter.adjust(this.life,25);
  393.          this.life += 25;
  394.       }
  395.       this.colorFlash(255,75,255,30);
  396.    }
  397.    function lifeMax()
  398.    {
  399.       _root.lifeMeter.adjust(this.life,100 - this.life);
  400.       this.life = 100;
  401.       this.colorFlash(255,0,0,30);
  402.    }
  403.    function speedBoost(num)
  404.    {
  405.       var _loc3_ = 0;
  406.       var _loc4_ = _root.powerUps.length;
  407.       while(_loc3_ < _loc4_)
  408.       {
  409.          if(_root.powerUps[_loc3_] == "speedBoost")
  410.          {
  411.             _root.removePowerUp("speedBoost");
  412.             break;
  413.          }
  414.          _loc3_ = _loc3_ + 1;
  415.       }
  416.       _root.speedBoost = new classes.misc.SpeedBoost(num);
  417.       _root.addPowerUp("speedBoost");
  418.       this.colorFlash(0,255,0,60);
  419.    }
  420.    function hit(pxMov, pyMov, pscale, ppower)
  421.    {
  422.       var _loc7_ = pxMov;
  423.       var _loc8_ = pyMov;
  424.       var _loc9_ = pscale;
  425.       var _loc4_ = _root.bro2ShipLevel <= 3 ? 1 - (_root.bro2ShipLevel - 1) * 0.2 : 1 - (_root.bro2ShipLevel - 4) * 0.2;
  426.       if(_root.bro2ShipVar == 3)
  427.       {
  428.          _loc4_ = 0.5;
  429.       }
  430.       var _loc5_ = ppower * _loc4_;
  431.       if(this.shieldOn && !this.inv)
  432.       {
  433.          _root.shield.hit();
  434.       }
  435.       else if(!this.inv)
  436.       {
  437.          var _loc6_ = this.life;
  438.          this.life -= _loc5_;
  439.          if(this.life < 1)
  440.          {
  441.             _root.bro2Life = 0;
  442.             _root.audio.playLevel2("broShip2X",_root.randRange(30,40));
  443.             this.inv = true;
  444.             this.clip.gun._visible = false;
  445.             this.clip.fx._visible = false;
  446.             this.colorTrans.redOffset = 0;
  447.             this.colorTrans.greenOffset = 0;
  448.             this.colorTrans.blueOffset = 0;
  449.             this.trans.colorTransform = this.colorTrans;
  450.             this.clip.body.gotoAndPlay("explode");
  451.             this.control = false;
  452.             this.facing = "switch";
  453.             this.fireDir = "";
  454.             var _loc3_ = 0;
  455.             while(_loc3_ < 5)
  456.             {
  457.                if(_root.bro2ShipVar == 1)
  458.                {
  459.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShip2_" + _root.bro2ShipLevel]);
  460.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShip2B_" + _root.bro2ShipLevel]);
  461.                }
  462.                else if(_root.bro2ShipVar == 7)
  463.                {
  464.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShipBlack"]);
  465.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShipBlackB"]);
  466.                }
  467.                else
  468.                {
  469.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShip2_3B"]);
  470.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShip2B_3B"]);
  471.                }
  472.                _loc3_ = _loc3_ + 1;
  473.             }
  474.             _root.bro2ShipVar = 1;
  475.          }
  476.          else
  477.          {
  478.             _root.lifeMeter.adjust(_loc6_,-1 * _loc5_);
  479.             this.nudge(_loc7_,_loc8_,_loc9_);
  480.             this.inv = true;
  481.             this.colorFlash(255,0,0,20);
  482.             _root.audio.playLevel3("broHit" + (random(3) + 1),_root.randRange(7,14));
  483.          }
  484.       }
  485.    }
  486.    function explosion()
  487.    {
  488.       _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-70,70),this.y + this.clip._height / 2 + _root.randRange(-70,70),_root.randRange(50,140),_root.randRange(70,100)]);
  489.    }
  490.    function shipToJetPack()
  491.    {
  492.       _root.bro2 = new classes.bro.Bro2(this.x + 6,this.y + 3);
  493.       _root.addChar("bro2");
  494.       _root.char = "bro2";
  495.       _root.shield = new classes.misc.Shield();
  496.       _root.addPowerUp("shield");
  497.       _root[_root.char].shieldOn = true;
  498.       if(_root.lastBoss && _root.char2 == "broShip1")
  499.       {
  500.          var _loc3_ = this.x >= 500 ? -50 : 1020;
  501.          var _loc4_ = this.x >= 500 ? "R" : "L";
  502.          _root.broShip1 = new classes.bro.BroShip1(_loc3_,280);
  503.          _root.addChar("broShip1");
  504.          _root.broShip1.tagTeam(_loc4_);
  505.       }
  506.       else if(_root.char2 == "broShip1" && !_root.broShip1.tagTeaming)
  507.       {
  508.          _root.rescue = true;
  509.          if(!_root.boss && !_root.broShip1.bg)
  510.          {
  511.             _root.broAction([7]);
  512.          }
  513.       }
  514.    }
  515.    function removeShip()
  516.    {
  517.       _root.removeChar("broShip2");
  518.    }
  519.    function fire_laserA()
  520.    {
  521.       _root.audio.playLevel5("laserA" + (random(5) + 1),random(4) + 6);
  522.       this.shotID = this.shotID + 1;
  523.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
  524.       _root.addBroShot("laserA" + this.shotID);
  525.       this.clip.gun.blast.gotoAndPlay("go");
  526.    }
  527.    function fire_twistLaser()
  528.    {
  529.       _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
  530.       this.shotID = this.shotID + 1;
  531.       _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  532.       _root.addBroShot("twistLaser" + this.shotID);
  533.       this.shotID = this.shotID + 1;
  534.       _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  535.       _root.addBroShot("twistLaser" + this.shotID);
  536.       this.clip.gun.blast.gotoAndPlay("go");
  537.    }
  538.    function fire_tripleTwistLaser()
  539.    {
  540.       _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
  541.       this.shotID = this.shotID + 1;
  542.       _root["twistLaserB" + this.shotID] = new classes.bro.TwistLaserB(this.shotX,this.shotY,this.fireDir,this.shotID);
  543.       _root.addBroShot("twistLaserB" + this.shotID);
  544.       this.shotID = this.shotID + 1;
  545.       _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  546.       _root.addBroShot("twistLaserC" + this.shotID);
  547.       this.shotID = this.shotID + 1;
  548.       _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  549.       _root.addBroShot("twistLaserC" + this.shotID);
  550.       this.clip.gun.blast.gotoAndPlay("go");
  551.    }
  552.    function fire_doubleLaserA()
  553.    {
  554.       _root.audio.playLevel5("doubleLaserA" + (random(5) + 1),random(10) + 8);
  555.       if(this.fireDir == "R" || this.fireDir == "L")
  556.       {
  557.          var _loc6_ = 0;
  558.          var _loc4_ = -6;
  559.          var _loc5_ = 0;
  560.          var _loc3_ = 6;
  561.       }
  562.       else
  563.       {
  564.          _loc6_ = -6;
  565.          _loc4_ = 0;
  566.          _loc5_ = 6;
  567.          _loc3_ = 0;
  568.       }
  569.       this.shotID = this.shotID + 1;
  570.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
  571.       _root.addBroShot("laserA" + this.shotID);
  572.       this.shotID = this.shotID + 1;
  573.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
  574.       _root.addBroShot("laserA" + this.shotID);
  575.       this.clip.gun.blast.gotoAndPlay("go");
  576.    }
  577.    function fire_tripleLaserA()
  578.    {
  579.       _root.audio.playLevel5("tripleLaserA" + (random(5) + 1),random(10) + 8);
  580.       if(this.fireDir == "R" || this.fireDir == "L")
  581.       {
  582.          var _loc6_ = 0;
  583.          var _loc4_ = -3;
  584.          var _loc5_ = 0;
  585.          var _loc3_ = 3;
  586.       }
  587.       else
  588.       {
  589.          _loc6_ = -3;
  590.          _loc4_ = 0;
  591.          _loc5_ = 3;
  592.          _loc3_ = 0;
  593.       }
  594.       this.shotID = this.shotID + 1;
  595.       _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,1,this.shotID);
  596.       _root.addBroShot("spreadLaserA" + this.shotID);
  597.       this.shotID = this.shotID + 1;
  598.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
  599.       _root.addBroShot("laserA" + this.shotID);
  600.       this.shotID = this.shotID + 1;
  601.       _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,2,this.shotID);
  602.       _root.addBroShot("spreadLaserA" + this.shotID);
  603.       this.clip.gun.blast.gotoAndPlay("go");
  604.    }
  605.    function fire_rapidLaser()
  606.    {
  607.       if(this.fireDir == "R" || this.fireDir == "L")
  608.       {
  609.          var _loc6_ = 0;
  610.          var _loc4_ = -6;
  611.          var _loc5_ = 0;
  612.          var _loc3_ = 6;
  613.       }
  614.       else
  615.       {
  616.          _loc6_ = -6;
  617.          _loc4_ = 0;
  618.          _loc5_ = 6;
  619.          _loc3_ = 0;
  620.       }
  621.       _root.audio.playLevel5("rapidLaser" + (random(5) + 1),random(30) + 10);
  622.       this.shotID = this.shotID + 1;
  623.       _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
  624.       _root.addBroShot("rapidLaser" + this.shotID);
  625.       this.shotID = this.shotID + 1;
  626.       _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
  627.       _root.addBroShot("rapidLaser" + this.shotID);
  628.       this.clip.gun.blast.gotoAndPlay("go");
  629.    }
  630.    function fire_bigLaser()
  631.    {
  632.       _root.audio.playLevel5("bigLaser" + (random(3) + 1),random(10) + 8);
  633.       this.shotID = this.shotID + 1;
  634.       _root["bigLaser" + this.shotID] = new classes.bro.BigLaser(this.shotX,this.shotY,this.fireDir,this.shotID);
  635.       _root.addBroShot("bigLaser" + this.shotID);
  636.       this.clip.gun.blast.gotoAndPlay("go2");
  637.       if(this.fireDir == "U")
  638.       {
  639.          this.nudge(0,2,100);
  640.       }
  641.       else if(this.fireDir == "D")
  642.       {
  643.          this.nudge(0,-2,100);
  644.       }
  645.       else if(this.fireDir == "L")
  646.       {
  647.          this.nudge(2,0,100);
  648.       }
  649.       else
  650.       {
  651.          this.nudge(-2,0,100);
  652.       }
  653.    }
  654.    function fire_superLaser()
  655.    {
  656.       _root.audio.playLevel5("superLaser" + (random(3) + 1),random(10) + 8);
  657.       if(this.sl == "top")
  658.       {
  659.          this.sl = "bot";
  660.          if(this.fireDir == "R" || this.fireDir == "L")
  661.          {
  662.             var _loc4_ = 0;
  663.             var _loc3_ = 6;
  664.          }
  665.          else
  666.          {
  667.             _loc4_ = 6;
  668.             _loc3_ = 0;
  669.          }
  670.       }
  671.       else
  672.       {
  673.          this.sl = "top";
  674.          if(this.fireDir == "R" || this.fireDir == "L")
  675.          {
  676.             _loc4_ = 0;
  677.             _loc3_ = -6;
  678.          }
  679.          else
  680.          {
  681.             _loc4_ = -6;
  682.             _loc3_ = 0;
  683.          }
  684.       }
  685.       this.shotID = this.shotID + 1;
  686.       _root["superLaserA" + this.shotID] = new classes.bro.SuperLaserA(this.shotX + _loc4_,this.shotY + _loc3_,this.fireDir,this.shotID);
  687.       _root.addBroShot("superLaserA" + this.shotID);
  688.       this.shotID = this.shotID + 1;
  689.       _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  690.       _root.addBroShot("superLaserB" + this.shotID);
  691.       this.shotID = this.shotID + 1;
  692.       _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  693.       _root.addBroShot("superLaserB" + this.shotID);
  694.       this.clip.gun.blast.gotoAndPlay("go2");
  695.       if(this.fireDir == "U")
  696.       {
  697.          this.nudge(0,2,100);
  698.       }
  699.       else if(this.fireDir == "D")
  700.       {
  701.          this.nudge(0,-2,100);
  702.       }
  703.       else if(this.fireDir == "L")
  704.       {
  705.          this.nudge(2,0,100);
  706.       }
  707.       else
  708.       {
  709.          this.nudge(-2,0,100);
  710.       }
  711.    }
  712.    function action1()
  713.    {
  714.       this.control = false;
  715.       this.dirXArray = ["L"];
  716.       this.dirYArray = ["","","U","U","D"];
  717.       this.changeDir();
  718.       this.f2 = "wander";
  719.       this.fireDir = "";
  720.    }
  721.    function action2()
  722.    {
  723.       this.gotoXY(0,80,"action2B");
  724.       this.dirX = "";
  725.    }
  726.    function action2B()
  727.    {
  728.       this.fireDir = "R";
  729.    }
  730.    function action3()
  731.    {
  732.       this.dirXArray = ["R"];
  733.       this.dirYArray = ["","D","D"];
  734.       this.changeDir();
  735.       this.f2 = "wander";
  736.       this.fireDir = "";
  737.    }
  738.    function action4()
  739.    {
  740.       this.gotoXY(0,150,"action4B");
  741.       this.clip.gotoAndPlay("faceLfireL");
  742.       this.dirX = "L";
  743.       this.fireDir = "L";
  744.       this.exit = true;
  745.    }
  746.    function action4B()
  747.    {
  748.       this.dirX = "L";
  749.       this.fireDir = "";
  750.    }
  751.    function action5()
  752.    {
  753.       this.goBG();
  754.       this.gotoXY(260,0,"action5B");
  755.    }
  756.    function goBG()
  757.    {
  758.       this.clip.swapDepths(9885);
  759.       this.bg = true;
  760.       this.control = false;
  761.       this.exit = true;
  762.       this.speed *= 0.8;
  763.       this.colorTrans.redOffset = -75;
  764.       this.colorTrans.greenOffset = -75;
  765.       this.colorTrans.blueOffset = -75;
  766.       this.trans.colorTransform = this.colorTrans;
  767.       this.clip._xscale = 66;
  768.       this.clip._yscale = 66;
  769.       this.fireDir = "";
  770.    }
  771.    function action5B()
  772.    {
  773.       this.gotoXY(0,800);
  774.    }
  775.    function action7()
  776.    {
  777.       this.goBG();
  778.       this.facing = _root["advanceDir" + _root.level];
  779.       if(_root["advanceDir" + _root.level] == "L")
  780.       {
  781.          this.gotoXY(-300,0);
  782.       }
  783.       else
  784.       {
  785.          this.gotoXY(1300,0);
  786.       }
  787.    }
  788.    function action11()
  789.    {
  790.       this.exit = true;
  791.       this.facing = "L";
  792.       this.gotoXY(-300,0);
  793.    }
  794.    function warpLeave()
  795.    {
  796.       this.control = false;
  797.       this.exit = true;
  798.       this.fireDir = "";
  799.       this.facing = "L";
  800.       this.gotoXY(-300,0);
  801.    }
  802.    function endPos()
  803.    {
  804.       this.xA = this.yA = 0;
  805.       this.speed = 2;
  806.       this.control = false;
  807.       this.facing = "L";
  808.       this.fireDir = "";
  809.       this.gotoXY(450,250);
  810.    }
  811.    function endPos2()
  812.    {
  813.       this.xA = this.yA = 0;
  814.       this.clip._x = this.x = this.tX = 450;
  815.       this.gotoXY(0,435,"endPos3");
  816.    }
  817.    function endPos3()
  818.    {
  819.       this.xA = this.yA = this.speed = 0;
  820.       this.gesture = true;
  821.       this.f2 = "";
  822.       this.clip._x = this.x = this.tX = 450;
  823.       this.clip._y = this.y = this.tY = 435;
  824.       this.hover = false;
  825.       this.clip.body.gotoAndPlay("endOpen");
  826.    }
  827.    function finalFunction()
  828.    {
  829.       _root.endBGClip.clip.buzzShip._visible = true;
  830.       _root.endBGClip.clip.buzzShip.play();
  831.    }
  832.    function endSeq(pdir)
  833.    {
  834.       this.tagTeaming = false;
  835.       this.speed = this.baseSpeed = 7;
  836.       this.exit = true;
  837.       this.weapon = "rapidLaser";
  838.       _root.bro2weapon = this.weapon;
  839.       this[this.weapon]();
  840.       this.facing = this.fireDir = pdir;
  841.       this.control = false;
  842.       var _loc3_ = this.facing != "L" ? 200 : 800;
  843.       this.gotoXY(_loc3_,280);
  844.    }
  845.    function endSeqB()
  846.    {
  847.       this.gotoXY(0,_root.deathHeadClip._y);
  848.    }
  849.    function endSeqMove()
  850.    {
  851.       this.speed = this.baseSpeed = 10;
  852.       this.endFire = true;
  853.       this.gotoXY(_root.randRange(100,900),_root.randRange(100,500),"endSeqMove");
  854.    }
  855.    function endStill()
  856.    {
  857.       this.endFire = false;
  858.       this.dirX = this.dirY = this.fireDir = "";
  859.       this.f2 = "";
  860.    }
  861.    function appear()
  862.    {
  863.       this.life += _root.randRange(35,50);
  864.       if(this.life > 100)
  865.       {
  866.          this.life = 100;
  867.       }
  868.       this.exit = true;
  869.       this.inv = true;
  870.       this.control = false;
  871.       if(this.x < 0)
  872.       {
  873.          this.facing = "R";
  874.          this.fireDir = "R";
  875.          this.gotoXY(150,0,"giveControl");
  876.       }
  877.       else
  878.       {
  879.          this.facing = "L";
  880.          this.fireDir = "L";
  881.          this.gotoXY(850,0,"giveControl");
  882.       }
  883.    }
  884.    function giveControl()
  885.    {
  886.       this.inv = false;
  887.       this.control = true;
  888.       this.exit = false;
  889.    }
  890.    function tagTeam(pdir)
  891.    {
  892.       this.speed *= 0.8;
  893.       this.life += _root.randRange(25,50);
  894.       if(this.life > 100)
  895.       {
  896.          this.life = 100;
  897.       }
  898.       this.inv = true;
  899.       this.control = false;
  900.       this.exit = true;
  901.       this.tagTeaming = true;
  902.       this.facing = pdir;
  903.       if(pdir == "R")
  904.       {
  905.          this.gotoXY(1300,0);
  906.       }
  907.       else
  908.       {
  909.          this.gotoXY(-300,0);
  910.       }
  911.    }
  912.    function getOut()
  913.    {
  914.       this.facing = "L";
  915.       this.fireDir = "";
  916.       this.exit = true;
  917.       this.gotoXY(-300,0,"",true);
  918.    }
  919.    function wave()
  920.    {
  921.       this.gesture = true;
  922.       this.clip.body.gotoAndPlay("wave");
  923.    }
  924.    function reanimate()
  925.    {
  926.       this.gesture = true;
  927.       this.clip.body.gotoAndPlay("reanimate");
  928.    }
  929.    function positionForSwitch(pdestX)
  930.    {
  931.       this.control = false;
  932.       this.gotoXY(pdestX,0,"action6B");
  933.       this.fireDir = "";
  934.       this.facing = "R";
  935.    }
  936.    function action6B()
  937.    {
  938.       this.gotoXY(0,_root.newShipClip._y);
  939.       this.facing = "switch";
  940.    }
  941.    function shipUpgrade(shipType)
  942.    {
  943.       this.control = false;
  944.       this.life = 100;
  945.       if(shipType == "ship2")
  946.       {
  947.          this.speed = this.baseSpeed = 8;
  948.          _root.bro2ShipLevel = 2;
  949.          this.clip.body.shipStyles.gotoAndStop(2);
  950.          this.clip.body.gotoAndPlay("close");
  951.       }
  952.       else if(shipType == "ship3")
  953.       {
  954.          this.speed = this.baseSpeed = 10;
  955.          _root.bro2ShipLevel = 3;
  956.          this.clip.body.shipStyles.gotoAndStop(3);
  957.          this.clip.body.gotoAndPlay("close");
  958.       }
  959.       else
  960.       {
  961.          this.speed = this.baseSpeed = 10;
  962.          _root.bro2ShipLevel = 3;
  963.          _root.bro2ShipVar = 3;
  964.          this.clip.body.shipStyles.gotoAndStop(8);
  965.          this.clip.body.gotoAndPlay("close");
  966.       }
  967.    }
  968.    function gotoXY(pdestX, pdestY, pmetFunction, pwave)
  969.    {
  970.       this.destX = pdestX;
  971.       this.destY = pdestY;
  972.       this.xyMetFunction = pmetFunction;
  973.       var _loc2_ = pwave;
  974.       if(this.destX != 0)
  975.       {
  976.          this.dirX = this.x <= this.destX ? "R" : "L";
  977.       }
  978.       if(this.destY != 0)
  979.       {
  980.          this.dirY = this.y <= this.destY ? "D" : "U";
  981.       }
  982.       this.f2 = "goingXY";
  983.       if(_loc2_)
  984.       {
  985.          this.wave();
  986.       }
  987.    }
  988.    function goingXY()
  989.    {
  990.       if(this.destX != 0 && Math.abs(this.x - this.destX) < this.speed + 1)
  991.       {
  992.          this.dirX = "";
  993.          var _loc2_ = true;
  994.       }
  995.       if(this.destX == 0)
  996.       {
  997.          _loc2_ = true;
  998.       }
  999.       if(this.destY != 0 && Math.abs(this.y - this.destY) < this.speed + 1)
  1000.       {
  1001.          this.dirY = "";
  1002.          var _loc3_ = true;
  1003.       }
  1004.       if(this.destY == 0)
  1005.       {
  1006.          _loc3_ = true;
  1007.       }
  1008.       if(_loc2_ && _loc3_)
  1009.       {
  1010.          this[this.xyMetFunction]();
  1011.       }
  1012.    }
  1013.    function changeDir()
  1014.    {
  1015.       this.dirX = this.dirXArray[random(this.dirXArray.length)];
  1016.       this.dirY = this.dirYArray[random(this.dirYArray.length)];
  1017.    }
  1018.    function wander()
  1019.    {
  1020.       if(random(100) > 93)
  1021.       {
  1022.          this.changeDir();
  1023.       }
  1024.    }
  1025.    function main()
  1026.    {
  1027.       this[this.f2]();
  1028.       if(this.endFire)
  1029.       {
  1030.          if(random(30) == 0)
  1031.          {
  1032.             var _loc4_ = ["L","R","D","U","","","",""];
  1033.             this.fireDir = _loc4_[random(8)];
  1034.          }
  1035.          if(random(60) == 0)
  1036.          {
  1037.             this.dirX = this.dirY = "";
  1038.             this.f2 = "";
  1039.          }
  1040.          else if(random(45) == 0)
  1041.          {
  1042.             this.endSeqMove();
  1043.          }
  1044.       }
  1045.       if(this.control)
  1046.       {
  1047.          if(Key.isDown(_root.moveU))
  1048.          {
  1049.             this.tY = this.y - this.speed;
  1050.             this.handState = "FU";
  1051.          }
  1052.          if(Key.isDown(_root.moveD))
  1053.          {
  1054.             this.tY = this.y + this.speed;
  1055.             this.handState = "BD";
  1056.          }
  1057.          if(Key.isDown(_root.moveL))
  1058.          {
  1059.             this.tX = this.x - this.speed;
  1060.             this.handState = this.facing != "R" ? "FU" : "BD";
  1061.          }
  1062.          if(Key.isDown(_root.moveR))
  1063.          {
  1064.             this.tX = this.x + this.speed;
  1065.             this.handState = this.facing != "R" ? "BD" : "FU";
  1066.          }
  1067.          if(Key.isDown(_root.fireU))
  1068.          {
  1069.             this.fire = true;
  1070.             this.shotY = this.y - 6;
  1071.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1072.             this.fireDir = "U";
  1073.          }
  1074.          else if(Key.isDown(_root.fireD))
  1075.          {
  1076.             this.fire = true;
  1077.             this.shotY = this.y + 42;
  1078.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1079.             this.fireDir = "D";
  1080.          }
  1081.          else if(Key.isDown(_root.fireL))
  1082.          {
  1083.             this.fire = true;
  1084.             this.shotX = this.x - 6;
  1085.             this.shotY = this.y + 33;
  1086.             this.fireDir = this.facing = "L";
  1087.          }
  1088.          else if(Key.isDown(_root.fireR))
  1089.          {
  1090.             this.fire = true;
  1091.             this.shotX = this.x + 39;
  1092.             this.shotY = this.y + 33;
  1093.             this.fireDir = this.facing = "R";
  1094.          }
  1095.          else
  1096.          {
  1097.             this.fire = false;
  1098.             this.fireDir = this.facing != "R" ? "L" : "R";
  1099.             this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
  1100.             this.fc = this.fc + 1;
  1101.          }
  1102.          if(!this.gesture)
  1103.          {
  1104.             this.clip.body.gotoAndStop(this.handState);
  1105.          }
  1106.       }
  1107.       else
  1108.       {
  1109.          if(this.dirY == "U")
  1110.          {
  1111.             this.tY = this.y - this.speed;
  1112.             this.handState = "FU";
  1113.          }
  1114.          if(this.dirY == "D")
  1115.          {
  1116.             this.tY = this.y + this.speed;
  1117.             this.handState = "BD";
  1118.          }
  1119.          if(this.dirX == "L")
  1120.          {
  1121.             this.tX = this.x - this.speed;
  1122.             this.handState = this.facing != "R" ? "FU" : "BD";
  1123.          }
  1124.          if(this.dirX == "R")
  1125.          {
  1126.             this.tX = this.x + this.speed;
  1127.             this.handState = this.facing != "R" ? "BD" : "FU";
  1128.          }
  1129.          if(this.fireDir == "U")
  1130.          {
  1131.             this.fire = true;
  1132.             this.shotY = this.y - 6;
  1133.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1134.          }
  1135.          else if(this.fireDir == "D")
  1136.          {
  1137.             this.fire = true;
  1138.             this.shotY = this.y + 42;
  1139.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1140.          }
  1141.          else if(this.fireDir == "L")
  1142.          {
  1143.             this.fire = true;
  1144.             this.shotX = this.x - 6;
  1145.             this.shotY = this.y + 33;
  1146.             this.facing = "L";
  1147.          }
  1148.          else if(this.fireDir == "R")
  1149.          {
  1150.             this.fire = true;
  1151.             this.shotX = this.x + 39;
  1152.             this.shotY = this.y + 33;
  1153.             this.facing = "R";
  1154.          }
  1155.          else
  1156.          {
  1157.             this.fire = false;
  1158.             var _loc3_ = this.facing != "R" ? "L" : "R";
  1159.             this.clip.gotoAndStop("face" + this.facing + "fire" + _loc3_);
  1160.             this.fc = this.fc + 1;
  1161.          }
  1162.          if(this.facing != "switch" && !this.gesture)
  1163.          {
  1164.             this.clip.body.gotoAndStop(this.handState);
  1165.          }
  1166.       }
  1167.       if(this.colorVars.flashing)
  1168.       {
  1169.          this.colorVars.c = this.colorVars.c + 1;
  1170.          this.colorTrans.redOffset = this.colorVars.r - this.colorVars.c * (this.colorVars.r / this.colorVars.cMax);
  1171.          this.colorTrans.greenOffset = this.colorVars.g - this.colorVars.c * (this.colorVars.g / this.colorVars.cMax);
  1172.          this.colorTrans.blueOffset = this.colorVars.b - this.colorVars.c * (this.colorVars.b / this.colorVars.cMax);
  1173.          if(this.colorVars.c >= this.colorVars.cMax)
  1174.          {
  1175.             this.colorVars.flashing = false;
  1176.             this.colorTrans.redOffset = 0;
  1177.             this.colorTrans.greenOffset = 0;
  1178.             this.colorTrans.blueOffset = 0;
  1179.          }
  1180.          this.trans.colorTransform = this.colorTrans;
  1181.       }
  1182.       if(!this.exit)
  1183.       {
  1184.          if(this.tX < 35)
  1185.          {
  1186.             this.tX = 35;
  1187.          }
  1188.          if(this.tX > 965 - this.w)
  1189.          {
  1190.             this.tX = 965 - this.w;
  1191.          }
  1192.          if(this.tY < 35)
  1193.          {
  1194.             this.tY = 35;
  1195.          }
  1196.          if(this.tY > 565 - this.h)
  1197.          {
  1198.             this.tY = 565 - this.h;
  1199.          }
  1200.       }
  1201.       else if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
  1202.       {
  1203.          if(this.tagTeaming)
  1204.          {
  1205.             _root.rescue = false;
  1206.          }
  1207.          _root.removeChar("broShip2");
  1208.          _root.bgWait.activateBro();
  1209.          if(_root.lastBoss && !_root.bgWaiting && this.bg)
  1210.          {
  1211.             _root.tagTeam([-50,280,"R"]);
  1212.          }
  1213.       }
  1214.       if(this.fire)
  1215.       {
  1216.          this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
  1217.          if(this.fc <= this.ofc)
  1218.          {
  1219.             this.fc = this.ofc + 1;
  1220.          }
  1221.          else
  1222.          {
  1223.             this.fc = this.fc + 1;
  1224.          }
  1225.          if(this.fc > this.fireFreq)
  1226.          {
  1227.             this.fc = 0;
  1228.             this["fire_" + this.weapon]();
  1229.          }
  1230.          this.ofc = this.fc;
  1231.       }
  1232.       if(this.tagTeaming)
  1233.       {
  1234.          _root.c = _root.c - 1;
  1235.          if(this.clip.hitTest(_root[_root.char + "Clip"]))
  1236.          {
  1237.             if(_root[_root.char].f2 != "dying")
  1238.             {
  1239.                _root.audio.playLevel2("tagTeam1",20);
  1240.                this.speed = this.baseSpeed;
  1241.                this.control = true;
  1242.                this.exit = false;
  1243.                this.weapon = _root.bro2Weapon = _root.bro1Weapon;
  1244.                this[this.weapon]();
  1245.                this.inv = false;
  1246.                this.tagTeaming = false;
  1247.                _root.rescue = false;
  1248.                _root.char2 = _root.char;
  1249.                _root.char = "broShip2";
  1250.                _root.shield.tagTeam();
  1251.                _root.bro1Life = _root[_root.char2].life;
  1252.                _root[_root.char2].control = false;
  1253.                _root[_root.char2].inv = true;
  1254.                _root[_root.char2].exit = true;
  1255.                _root[_root.char2].fireDir = "";
  1256.                if(this.facing == "R")
  1257.                {
  1258.                   _root[_root.char2].facing = "R";
  1259.                   _root[_root.char2].gotoXY(1300,0,"",true);
  1260.                }
  1261.                else
  1262.                {
  1263.                   _root[_root.char2].facing = "L";
  1264.                   _root[_root.char2].gotoXY(-300,0,"",true);
  1265.                }
  1266.             }
  1267.          }
  1268.       }
  1269.       this.tX += this.xA;
  1270.       this.tY = !this.hover ? this.tY + this.yA : this.tY + this.yA + 0.3 * Math.sin(this.hc += 0.05);
  1271.       this.x = this.tX;
  1272.       this.y = this.tY;
  1273.       this.clip._x = this.x;
  1274.       this.clip._y = this.y;
  1275.    }
  1276. }
  1277.